# 无关联时访问接口
import requests

url = 'http://192.168.196.128/apitest/refer/info/'
res = requests.get(url)
print(res.text)
# 访问被关联接口
url = 'http://192.168.196.128/apitest/refer/login/'
args = {'username': 'admin', 'password': '123456'}
res = requests.post(url, args)
print(res.text)  # 查看结果是否访问成功
print(res.cookies)  # 响应头中的cookies，收到的cookies
# 访问被测接口
cook = res.cookies
url = 'http://192.168.196.128/apitest/refer/info/'
res = requests.get(url, cookies=cook)
print(res.text)
